//
//  Observable+Ex.swift
//  
//
//  Created by tank on 2021/10/18.
//

import Foundation
import Moya
import RxSwift

public extension ObservableType where Element == Response {
    func map<T: Codable>(type: T.Type) -> Observable<APIResult<T>> {
        flatMap { Observable.just(try $0.map()) }
    }
    
    func map<T>(type: T.Type) -> Observable<APIResult<T>> {
        flatMap { Observable.just(try $0.map()) }
    }
}
